import java.util.LinkedList;

public class RandomGenerator {

    public static void main(String[] args) {
        LinkedList<Integer> list=new LinkedList<>();
        int range=30,limit=20;
        int rangeCandidate,limitCandidate;
        try {
            rangeCandidate=Integer.parseInt(args[0]);
            assert rangeCandidate>0;
            range=rangeCandidate;
        } catch (Exception e) {
            System.out.println("using default range "+range);
        }
        try {
            limitCandidate=Integer.parseInt(args[1]);
            assert limitCandidate>0;
            limit=limitCandidate;
        } catch (Exception e) {
            System.out.println("using default limit "+limit);
        }
        while(list.size()<limit){
            int generated=(int)(Math.random()*(range-1))+1;
            if(list.contains(generated))continue;
            list.add(generated);
        }
        for(var e:list){
            System.out.print(1+" "+e+" ");
        }
        System.out.println();
        for(var e:list){
            System.out.print(e+" ");
        }
    }
}